using System.Collections.Generic;
using System.Diagnostics;
using Wargame_V3_1;

/// <summary>
/// 根据传入的action更新算子状态，同时输出Dictionary<string, object>形式的interact，interact在GameEvolver中转成DynamicInteract对象
/// </summary>
public dynamic CalloutAction(Dictionary<string, dynamic> param)
{
    // === 取值 ===
    Operator thisOpr = param["thisOpr"];
    dynamic action = param["action"];
    //List<Operator> oprs = param["oprs"];
    //Map map = param["map"];
    //List<Target> targets = param["targets"];

    // === 调用 ===
    dynamic actionType = action.Type;
    if (actionType == "Shoot")
    {
        return thisOpr.InvokeMethod("CalloutShootAction", param);
    }
    else if (actionType == "Move")
    {
        return thisOpr.InvokeMethod("CalloutMoveAction", param);
    }
    else if (actionType == "Occupy")
    {
        return thisOpr.InvokeMethod("CalloutOccupyAction", param);
    }
    else if (actionType == "ChangeState")
    {
        return thisOpr.InvokeMethod("CalloutChangeStateAction", param);
    }
    else if (actionType == "StopMove")
    {
        return thisOpr.InvokeMethod("CalloutStopMoveAction", param);
    }
    else if (actionType == "WeaponLock")
    {
        return thisOpr.InvokeMethod("CalloutWeaponLockAction", param);
    }
    else if (actionType == "WeaponUnfold")
    {
        return thisOpr.InvokeMethod("CalloutWeaponUnfoldAction", param);
    }
    else
    {
        Trace.TraceWarning($"未录入的动作类型：{actionType}");
        return null;
    }
}
